@extends('shared.master')

@section('content')
<div class="container-fluid">
    <div class="row">
        <div class="col-lg-12">
            <ol class="breadcrumb layout-title">
                                    <li><a href="{{url('issue')}}"><i class="fa fa-user fa-fw"></i> Issue</a></li>
                                    <li class="active" > Detail</li>
            </ol>
            <div class='col col-lg-8'>
            {{PageData::Error()}}
            <div class="form-group">
                <label>Name</label>
                <p class="form-control-static">{{$Model->getName()}}</p>
            </div>
            <div class="form-group">
                <label>Description</label>
                <p class="form-control-static">{{$Model->getDescription()}}</p>
            </div>
            <div class="form-group">
                <label>Status</label>
                <p class="form-control-static">{{$Model->getStatus()!=null ? $Model->getStatus()->getName() : "-"}}</p>
            </div>
            <div class="form-group">
                <label>Priority</label>
                <p class="form-control-static">{{$Model->getPriority()!=null ? $Model->getPriority()->getName() : "-"}}</p>
            </div>
            <div class="form-group">
                <label>Task</label>
                <p class="form-control-static">{{$Model->getTask()!=null ? $Model->getPriority()->getName() : "-" }}</p>
            </div>
            <p>
            <div class="form-group">
                <label>Created By</label>
                <p class="form-control-static">{{$Model->getCreatedBy()!=null ? $Model->getCreatedBy()->getName() : "-"}}</p>
            </div>
            <div class="form-group">
                <label>Created Date</label>
                <p class="form-control-static">{{$Model->getCreatedDate() }}</p>
            </div>
            
            <p>
                @if ($userInformation->getGroup()->getId()=='leader')
                <button onClick="location.href='{{ action('IssueController@edit', $Model->getId()) }}'" type="button" class="btn btn-primary">Edit</button>
                @elseif ($userInformation->getGroup()->getId()=='employee')
                <button onClick="location.href='{{ action('IssueController@done', $Model->getId()) }}'" type="button" class="btn btn-primary">Done</button>
                @endif
                <button onClick="location.href='{{url('issue')}}'" type="button" class="btn btn-primary">Close</button>
            </p>
            </div>
            <div class='col col-lg-4'>
                <div class="panel panel-default">
                <div class="panel-heading">
                <h3 class="panel-title">Comment</h3>
                </div>
            @if ($Model->getComment() != null)
                <table class="table table-striped table-bordered table-hover" id="tbl_data_user" >
                    <tbody>
                        @foreach ($Model->getComment() as $item)
                        <tr class="odd gradeX" onclick="">
                            <td><b>{{$item->getCommentDetail()}}</b><br>
                                {{$item->getEmployee()->getName()}} - {{$item->getCreatedDate()}}
                            </td>
                        </tr>
                        @endforeach
                        
                    </tbody>
                </table>
            @else
                <div class="panel-body">
                    No Comment Found, Wanna Add Some! :)
                </div>
            @endif
                 <div class="panel-footer">
                    {{ Form::open(array('url' => '#', 'id' => 'createComment')) }}
                    <div class="input-group">
                        <input type="text" name='name' class="form-control" placeholder="Write Comment" aria-describedby="basic-addon2">
                        <input type="hidden" name='issue_id' value='{{$Model->getId()}}' class="form-control">
                        <span class="input-group-addon  comment" id="basic-addon2" onClick='document.getElementById("createComment").submit()'><i class="fa fa-comment "></i></span>
                    </div>
                    {{ Form::close() }}
                </div>
                </div>
            </div>
        </div>
        <!-- /.col-lg-12 -->
    </div>
    <!-- /.row -->
</div>
<!-- /.container-fluid -->
    <script>
    
    </script>
@stop